package com.wechet.serveice.impl;

import com.wechet.DAO.SellerInfoDao;
import com.wechet.common.UserStatus;
import com.wechet.domain.SellerInfo;
import com.wechet.exception.SellException;
import com.wechet.serveice.SellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by sc on 2017/9/29.
 */
@Service
public class SellerServiceImpl implements SellerService {

    @Autowired
    private SellerInfoDao sellerInfoDao;

    @Override
    public SellerInfo findSellerInfoByOpenId(String openid) {
        SellerInfo sellerInfo = sellerInfoDao.findByOpenid(openid);
        if (sellerInfo == null) {
            throw new SellException(UserStatus.NOT_EXIST);
        }
        return sellerInfo;
    }
}
